package com.qfedu.openplateform.manager.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qfedu.openplateform.manager.dao.ApiMappingMapper;
import com.qfedu.openplateform.manager.entity.ApiMapping;
import com.qfedu.openplateform.manager.service.ApiMappingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


@Service
@Transactional
public class ApiMappingServiceImpl implements ApiMappingService {

    @Autowired
    private ApiMappingMapper apiMappingMapper;

    @Override
    public PageInfo<ApiMapping> findALlApiMapping(ApiMapping apiMapping, Integer page, Integer pageSize) {
        PageHelper.startPage(page, pageSize);
        return new PageInfo(apiMappingMapper.getApiMappingList(apiMapping));
    }

    @Override
    public void addApiMapping(ApiMapping apiMapping) {
        apiMappingMapper.addApiMapping(apiMapping);
    }

    @Override
    public void updateApiMapping(ApiMapping apiMapping) {
        apiMappingMapper.updateApiMapping(apiMapping);
    }

    @Override
    public void deleteApiMappings(int[] ids) {
        for (int id : ids) {
            apiMappingMapper.deleteApiMappings(id);
        }
    }

}
